package com.globallogic.javatrainings.sergiiivanov.controller;

import java.util.Random;

/**
 * Random input generator intended to catch error on unexpected the user action<br>
 * Turned on by <code>-brute</code> command line parameter
 */
class Brute {
    static Random r;

    /**
     * When replaces System.in, generates random numeric input in range -1..18
     * 
     * @return String with random number in range -1..18
     */
    static String nextLine() {
        if (r == null) {
            r = new Random();
        }
        int post = 0;
        while (post == 0)
            post = r.nextInt(20) - 1;
        return Integer.toString(post);
    }

}
